<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>案例</title>
    <style>
        .active{
            color:red;
        }
    </style>
</head>

<body>
    <script src="js/vue.js"></script>
    <div id="app">
        <ul>
            <li :class="{active:currentIndex == index}" v-for="(item,index) in movies" :key="item" @click="liClick(index)">{{item}}</li>
        </ul>
    </div>

    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                movies:["星际穿越","飞驰人生","长津湖","迪迦奥特曼"],
                currentIndex:''
            },
            methods:{
                liClick(index){
                     this.currentIndex = index
                }
            }
        })
    </script>
</body>

</html>